<template>
  <div class="left_container">
    <search-bar @query_click="handleQueryClick" @reset_click="handleResetClick" />
    <operation-bar ref="operation_bar" @click_create_item="handleClickCreateItem" />
    <pagination-table ref="pagination_table" @select_click_item="handleClickItem" />
    <!-- 审核流程 -->
    <!-- <my-form-audit ref="my_form_audit" /> -->
  </div>
</template>

<script>
import SearchBar from './search-bar'
import PaginationTable from './pagination-table'
/** 可选：表单组件，操作栏组件，抽屉组件 */
// import MyFormAudit from './form/audit.vue'
import OperationBar from './operation-bar'
export default {
  name: 'ItemList',
  /** 可选：表单组件，操作栏组件，抽屉组件 */
  components: {
    SearchBar,
    PaginationTable,
    OperationBar,
  },
  data () {
    return {
      activeName: 'left',
      selectList: [],//列表勾选的数组
    }
  },
  methods: {
    handleClick (tab, event) {
      console.log(tab, event);
    },
    /** 搜索栏组件事件处理----------------------------------------------------------- */
    /** 点击查询栏【查询】按钮 */
    handleQueryClick (queryParams) {
      this.$refs['pagination_table'].handleQuery(queryParams)
    },
    /** 点击查询栏【重置】按钮 */
    handleResetClick () {
      this.$refs['pagination_table'].handleQuery(null)
    },
    /** 操作栏组件的事件处理 -----------------------------------------------------------*/
    /** 点击操作栏【采购申请】按钮 */
    handleClickCreateItem () {
      if (this.selectList.length) {
        this.$emit('click_create_createitem', this.selectList)
      } else {
        this.$message({
          message: '请勾选低于最低预警值的物料！',
          type: 'warning'
        });
      }
    },
    // 表单组件事件处理
    /** 表单提交成功 */
    handleSubmitSuccess () {
      this.$refs['pagination_table'].refreshList()
    },
    /** 页码表格组件事件处理 -----------------------------------------------------------*/
    /** 勾选列表参数 */
    handleClickItem (val) {
      this.selectList = val
    },
    /** 点击列表【详情】按钮 */
    // handleClickItemDetail(id) {
    //   this.$refs['item_detail_drawer'].handleOpenDrawer(id)
    // },
    // 传递子级id给父级tab标签
    // handleReceprion (id) {
    //   this.$emit('click_create_receptiondate', id)
    // }
  }
}
</script>
<style lang="scss" scoped>
.left_container {
  padding: 0;
}
</style>
